{$CLEO .cs}
thread 'ogf_1' 
:start
repeat
repeat

wait 0 
until if Player.Defined(0)
077E: get_active_interior_to 22@ 
until if 22@ == 0
Model.Load(#fam1)
Model.Load(#MAVERICK)
Model.Load(#AK47)     
Model.Load(#ROCKETLA)      
038B: load_requested_models 

while true
    wait 0                                           
    if and                                            
       Model.Available(#fam1)                                
       Model.Available(#MAVERICK)                             
       Model.Available(#AK47)                                  
       Model.Available(#ROCKETLA)                             
    then break                                       
    end                                              
end
WHILE TRUE
    wait 0                                                                                                  
    04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset 50.0 50.0 50.0                   
    04C4: store_coords_to 6@ 7@ 8@ from_actor $PLAYER_ACTOR with_offset -50.0 -50.0 0.0                   
    0208: 9@ = random_float_in_ranges 1@ 6@                                                                 
    0208: 10@ = random_float_in_ranges 2@ 7@                                                                
    0087: 11@ = 3@ // (float)                                                                               
    if 00C2:   sphere_onscreen 9@ 10@ 11@ radius 5.0                                                        
    JF BREAK                                                                                                
END 
4@ = Car.Create(#MAVERICK, 9@, 10@, 11@)
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
Car.SetImmunities(4@, 1, 1, 1, 1, 1)
Car.Health(4@) = 5000
039F: set_car 4@ race_to 1@ 2@
0825: set_helicopter 4@ instant_rotor_start 
0726: heli 4@ follow_actor $PLAYER_ACTOR follow_car -1 radius 25.0 
07BB: set_heli 4@ horizontal_thrust_power 6 
//--------------------------------------------
5@ = Actor.CreateAsDriver(Gang2, #fam1, 4@)
Actor.Health(5@) = 100000
Actor.SetImmunities(5@, 1, 1, 1, 1, 1)
Actor.SetMaxHealth(5@, 1000)
0446: set_actor 5@ dismemberment_possible 0
//--------------------------------------------
12@ = Actor.Create(Gang2, #fam1, 9@, 10@, 11@)
Actor.Health(12@) = 1000
Actor.SetImmunities(12@, 0, 1, 1, 1, 1)
0446: set_actor 12@ dismemberment_possible 0 
Actor.WeaponAccuracy(12@) = 90
0464: put_actor 12@ into_turret_on_car 4@ at_car_offset 1.7 1.3 -0.1 position 3 shooting_angle_limit 360.0 with_weapon 0
20@ = Actor.Create(Gang2, #fam1, 9@, 10@, 11@)
Actor.Health(20@) = 1000
Actor.SetImmunities(20@, 0, 1, 1, 1, 1)
0446: set_actor 20@ dismemberment_possible 0 
Actor.WeaponAccuracy(20@) = 90
0464: put_actor 20@ into_turret_on_car 4@ at_car_offset -1.7 1.3 -0.1 position 3 shooting_angle_limit 360.0 with_weapon 0
//--------------------------------------------------------------------------------------------
31@ = 0
//RESET VAR
8@ = 1
7@ = 0
6@ = 0
0@ = 0
1@ = 0
2@ = 0
11@ = 0
//--------
VAR
1@:FLOAT
2@:FLOAT
7@:FLOAT
12@:int
0@:int
5@:int
END
22@ = FALSE
WHILE TRUE
    WAIT 0
    if not Car.Wrecked(4@)
    THEN
        Actor.StorePos(12@, 17@, 18@,  19@)                                                                                   
        if 0AE1: 0@ = random_actor_near_point 17@ 18@ 19@ in_radius 1000.0 find_next 1 pass_deads 0 //IF and SET              
        then                                                                                                                  
            if not 0@ == -1                                                                                                   
            then                                                                                                              
                if and                                                                                                        
                   not actor.Dead(0@)                                                                                         
                   not 0@ == 12@ //vehicle gunner                                                                             
                   not 0@ == 5@  //vehicle driver                                                                             
                then                                                                                                          
                    089F: get_actor 0@ pedtype_to 3@                                                                          
                    if or                                                                                                     
                        3@ == 7  //GANG1 (Ballas)                                                                             
                        3@ == 9  //GANG3 (Los Santos Vagos)                                                                   
                        3@ == 10  //GANG4 (San Fierro Rifa)                                                                   
                        3@ == 11  //GANG5 (Da Nang Boys)                                                                      
                        3@ == 12  //GANG6 (Mafia)                                                                             
                        3@ == 13  //GANG7 (Mountain Cloud Triad)                                                              
                        3@ == 14  //GANG8 (Varrio Los Aztecas)
                        3@ == 6  //GANG1 (Ballas)                                                                       
                    then                                                                                                      
                        IF 0202:   actor 0@ near_car 4@ radius 100.0 100.0 sphere 0                                 
                        THEN                                                                                                   
                            04C4: store_coords_to 19@ 29@ 30@ from_actor 0@ with_offset 0.0 30.0 0.0                
                            04A2: set_heli 4@ fly_to 19@ 29@ 30@ altitude_between 25.0 and 25.0                                
                            IF  8@ == 2                                                                                        
                            THEN //______________________________________________________ak47 attack
                                if and
                                    not actor.Dead(0@)
                                    not actor.Dead(12@)
                                then
                                       
                                    Actor.GiveWeaponAndAmmo(12@, 30, 9999)                                                        
                                    07DD: set_actor 12@ attack_rate 100 // previously known as temper_to                          
                                    Actor.WeaponAccuracy(12@) = 98
                                    0208: 27@ = random_float_in_ranges -20.4 20.4                                                 
                                    0208: 28@ = random_float_in_ranges -20.4 20.4
                                    04C4: store_coords_to 19@ 29@ 30@ from_actor 0@ with_offset 27@ 0.0 28@          
                                    0668: AS_actor 12@ rotate_and_shoot_at 19@ 29@ 30@ 2000 ms
                                end
                                //--------------------------------------------------------------------
                                if and
                                    not actor.Dead(0@)
                                    not actor.Dead(20@)
                                then
                                   
                                    Actor.GiveWeaponAndAmmo(20@, 30, 9999)                                            
                                    07DD: set_actor 20@ attack_rate 100 // previously known as temper_to              
                                    Actor.WeaponAccuracy(20@) = 98
                                    0208: 27@ = random_float_in_ranges -20.4 20.4                                        
                                    0208: 28@ = random_float_in_ranges -20.4 20.4                                         
                                    04C4: store_coords_to 19@ 29@ 30@ from_actor 0@ with_offset 27@ 0.0 28@                       
                                    0668: AS_actor 12@ rotate_and_shoot_at 19@ 29@ 30@ 2000 ms                                    
                                end                                                                                               
                                //_______________________________________________________________
                            END                                                                         
                            IF  8@ == 1                                                              
                            THEN //______________________________________________________rpg attack
                                if and
                                    not actor.Dead(0@)
                                    not actor.Dead(12@)
                                then
                                    if 0449:   actor 0@ in_a_car 
                                    then   
                                    Actor.GiveWeaponAndAmmo(12@, 35, 9999)                                                        
                                    07DD: set_actor 12@ attack_rate 100 // previously known as temper_to                          
                                    Actor.WeaponAccuracy(12@) = 98
                                    0208: 27@ = random_float_in_ranges -20.4 20.4                                                 
                                    0208: 28@ = random_float_in_ranges -20.4 20.4
                                    04C4: store_coords_to 19@ 29@ 30@ from_actor 0@ with_offset 27@ 0.0 28@          
                                    0668: AS_actor 12@ rotate_and_shoot_at 19@ 29@ 30@ 2000 ms
                                    end
                                end
                                //--------------------------------------------------------------------
                                if and
                                    not actor.Dead(0@)
                                    not actor.Dead(20@)
                                then
                                    if 0449:   actor 0@ in_a_car 
                                    then
                                    Actor.GiveWeaponAndAmmo(20@, 35, 9999)                                            
                                    07DD: set_actor 20@ attack_rate 100 // previously known as temper_to              
                                    Actor.WeaponAccuracy(20@) = 98
                                    0208: 27@ = random_float_in_ranges -20.4 20.4                                        
                                    0208: 28@ = random_float_in_ranges -20.4 20.4                                         
                                    04C4: store_coords_to 19@ 29@ 30@ from_actor 0@ with_offset 27@ 0.0 28@                       
                                    0668: AS_actor 12@ rotate_and_shoot_at 19@ 29@ 30@ 2000 ms
                                    end                                    
                                end                                                                                               
                                //_______________________________________________________________
                            END                                                                                                         
                        ELSE                                                                                                   
                            04C4: store_coords_to 19@ 29@ 30@ from_actor $PLAYER_ACTOR with_offset 0.0 30.0 0.0                
                            04A2: set_heli 4@ fly_to 19@ 29@ 30@ altitude_between 25.0 and 25.0                                    
                        END
                    end
                end
            end
        end                                                                                                        
        IF 8@ == 1                     
        THEN                           
            IF NOT 31@ >= 50           
            THEN 31@ += 1              
            ELSE 8@ = 2                
            END                        
        END                            
        IF 8@ == 2                     
        THEN                           
            IF 31@ > 0                 
            THEN 31@ -= 1              
            END                        
        END                            
        IF 31@ == 1                    
        THEN 8@ = 1                    
             7@ = 0                    
        END                            
    END
    0AF0: 2@ = get_int_from_ini_file "CLEO\POZIT.INI" section "ogf_1" key "get" 
    if OR 
        2@ == 1
        02BF:   car 4@ sunk 
        Car.Wrecked(4@)
        PLAYER.Wasted(0)
    THEN
        break
    end
    if and
        ACTOR.Dead(12@)
        ACTOR.Dead(20@)
    then
        break
    end
end    
    
Actor.RemoveReferences(12@)                
Actor.RemoveReferences(5@)                 
Actor.RemoveReferences(20@)                
Car.RemoveReferences(4@)                   
CAR.Destroy(4@)                               
end_thread                                     

